
package scalaExec.gui;

import java.awt.*;
import javax.swing.*;
import java.util.*;

import scalaExec.Interpreter.*;
public class watchScalaWorkspace  {
     // the symbol tableof all workspace's variables
            
    public watchScalaWorkspace()
    	{
        
    }

    static public void displayScalaSciBinding(final JPanel dPanel) {

        scalaExec.gui.AutoCompletionWorkspace.scanVars = scalaExec.gui.workspaceVarsCollector.getAllVars();
        
       JTable varsTable = new JTable(GlobalValues.model);

       JScrollPane  varsTablePane = new JScrollPane(varsTable);
        dPanel.removeAll();
        dPanel.setLayout(new BorderLayout());
        dPanel.add(varsTablePane);
       
          
 // pass the defined variables to the definedWorkspaceVariables TreeSet,  in order the ScalaLab editor to color them
   if (GlobalValues.myEdit  != null)  {   // if the ScalaLab editor was initialized at this working session
          scalalabEdit.scalalabEditor.definedWorkspaceVariables.clear();
       int numOfVariables = varsTable.getRowCount();
       for (int k=0; k<numOfVariables; k++)  {
            String currentVariableName = (String)varsTable.getValueAt(k, 0);
            if (currentVariableName != null && currentVariableName.equals("userCompute$$")==false)    // userCompute$$ is a synthetically generated variable
               scalalabEdit.scalalabEditor.definedWorkspaceVariables.add(currentVariableName);
        }
     }

  }

}
     

